package ch.janotta.slawo.da;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;


public enum Focus {
  // Communication Focuses:
  AnimalHandling(Ability.Communication),
  Bargaining(Ability.Communication),
  Deception(Ability.Communication),
  Disguise(Ability.Communication),
  Etiquette(Ability.Communication),
  Gambling(Ability.Communication),
  Investigation(Ability.Communication),
  Leadership(Ability.Communication),
  Performance(Ability.Communication),
  Persuasion(Ability.Communication),
  Seduction(Ability.Communication),

  // Constitution Focuses:
  Drinking(Ability.Constitution),
  Rowing(Ability.Constitution),
  Running(Ability.Constitution),
  Stamina(Ability.Constitution),
  Swimming(Ability.Constitution),

  // Cunning Focuses:
  Arcane_Lore(Ability.Cunning),
  Cartography(Ability.Cunning),
  Cultural_Lore(Ability.Cunning),
  Engineering(Ability.Cunning),
  Evaluation(Ability.Cunning),
  Healing(Ability.Cunning),
  Heraldry(Ability.Cunning),
  Historical_Lore(Ability.Cunning),
  Military_Lore(Ability.Cunning),
  Musical_Lore(Ability.Cunning),
  Natural_Lore(Ability.Cunning),
  Navigation(Ability.Cunning),
  Research(Ability.Cunning),
  Religious_Lore(Ability.Cunning),
  Writing(Ability.Cunning),

  // Dexterity Focuses:
  Acrobatics(Ability.Dexterity),
  Bows(Ability.Dexterity),
  Brawling(Ability.Dexterity),
  Calligraphy(Ability.Dexterity),
  Initiative(Ability.Dexterity),
  Legerdemain(Ability.Dexterity),
  LightBlades(Ability.Dexterity),
  LockPicking(Ability.Dexterity),
  Riding(Ability.Dexterity),
  Staves(Ability.Dexterity),
  Stealth(Ability.Dexterity),
  Traps(Ability.Dexterity),

  // Magic Focuses:
  Creation(Ability.Magic),
  Entropy(Ability.Magic),
  Primal(Ability.Magic),
  Spirit(Ability.Magic),

  // Perception Focuses:
  Empathy(Ability.Perception),
  Hearing(Ability.Perception),
  Searching(Ability.Perception),
  Seeing(Ability.Perception),
  Smelling(Ability.Perception),
  Tracking(Ability.Perception),

  // Strength Focuses:
  Axes(Ability.Strength),
  Bludgeons(Ability.Strength),
  Climbing(Ability.Strength),
  Driving(Ability.Strength),
  HeavyBlades(Ability.Strength),
  Intimidation(Ability.Strength),
  Jumping(Ability.Strength),
  Might(Ability.Strength),
  Spears(Ability.Strength),

  // Willpower Focuses:
  Courage(Ability.Willpower),
  Faith(Ability.Willpower),
  Morale(Ability.Willpower),
  SelfDiscipline(Ability.Willpower)
  ;

  private static HashMap<Ability, List<Focus>> ABILITY_FOCUSSES_LOOKUP_TABLE;

  private Ability ability;

  private Focus(Ability ability) {
    this.ability = ability;
    List<Focus> focusses = getAbilityFocusses(ability);
    focusses.add(this);
  }

  public Ability getAbility() {
    return ability;
  }

  public static List<Focus> getAbilityFocusses(Ability ability) {
    if (ABILITY_FOCUSSES_LOOKUP_TABLE == null) {
      ABILITY_FOCUSSES_LOOKUP_TABLE = new HashMap<>();
    }
    List<Focus> focusses = ABILITY_FOCUSSES_LOOKUP_TABLE.get(ability);
    if (focusses == null) {
      focusses = new ArrayList<>();
      ABILITY_FOCUSSES_LOOKUP_TABLE.put(ability, focusses);
    }
    return focusses;
  }

  public String toString() {
    return this.getAbility().name() + " (" + this.name() + ")";
  }
}
